Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sort mime types alphabetically #4278

Merged
merged 1 commit into from
Sep 25, 2023
Merged

sort mime types alphabetically #4278

merged 1 commit into from
Sep 25, 2023

Conversation

Nriver
Copy link
Contributor

@Nriver Nriver commented Sep 22, 2023

No description provided.

@Nriver
Copy link
Contributor Author

Nriver commented Sep 22, 2023

I was trying https://github.com/rauenzi/Trilium-LaTeXPreview which requires to enble LaTeX type of note. But had little trouble finding it.

It's not alphabetically ordered.
ksnip_20230922-092029

It's somewhere down in the list, surrounded by "S".
ksnip_20230922-092050

This is what it looks like after sort.
ksnip_20230922-092146

There are several language names are not in the alphabetical order. I've reordered them all, with the except for Plain Text which is on the top.

@Nriver
Copy link
Contributor Author

Nriver commented Sep 22, 2023

Just for memo, the code for sort

// sort by title
MIME_TYPES_DICT.sort((a, b) => {
    const titleA = a.title.toLowerCase();
    const titleB = b.title.toLowerCase();
    if (titleA < titleB) {
        return -1;
    }
    if (titleA > titleB) {
        return 1;
    }
    return 0;
});

logInfo(JSON.stringify(MIME_TYPES_DICT));

@zadam zadam merged commit c14ce2c into zadam:master Sep 25, 2023
2 checks passed
@zadam
Copy link
Owner

zadam commented Sep 25, 2023

Thx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants